<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        .box{
            width: 200px;
            height: 200px;
            margin:100px auto;
            position: relative;
            /*让box默认旋转，方便观察*/
            transform: rotate3d(1,1,0,30deg);
            /*让子元素保留3d变换之后的效果*/
            transform-style: preserve-3d;
            /*添加透视景深效果*/
            perspective: 0px;
            /*设置透视的观察角度*/
            /* perspective-origin: 0px 0px; */
            transition: all 2s linear;
        }

        .box:hover {
            transform: rotate3d(1,1,0,330deg);
        }

        .box > div{
            width: 200px;
            height: 200px;
            position: absolute;
            opacity: 0.5;
        }
        .front{
            background-color: red;
            transform: translateZ(100px);
        }
        .back{
            background-color: green;
            transform: translateZ(-100px) rotateY(180deg);
        }
        .left{
            background-color: blue;
            /*移动+旋转*/
            transform: translateX(-100px) rotateY(-90deg);
        }
        .right{
            background-color: pink;
            transform: translateX(100px) rotateY(90deg);
        }
        .top{
            background-color: purple;
            transform: translateY(-100px) rotateX(90deg);
        }
        .bottom{
            background-color: orange;
            transform: translateY(100px) rotateX(-90deg);
        }
    </style>
</head>
<body>
<div class="box">
    <div class="front">front</div>
    <div class="back">back</div>
    <div class="left">left</div>
    <div class="right">right</div>
    <div class="top">top</div>
    <div class="bottom">bottom</div>
</div>
</body>
</html>